// This file is part of VideoLan.Inteop
//
// Copyright (C) 2008, Michael Melendez, http://www.MeediOS.com
//
//VideoLan.Inteop is free software; you can redistribute it and/or
//modify it under the terms of the GNU Lesser General Public
//License as published by the Free Software Foundation; either 
//version 2.1 of the License, or (at your option) any later version.
//
//VideoLan.Inteop is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
//Lesser General Public License for more details.
//
//You should have received a copy of the GNU Lesser General Public 
//License along with this library.  If not, see <http://www.gnu.org/licenses/>.

using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Text;

namespace VideoLan
{
    public class VlmStreamCollection<T> : IEnumerable where T : VlmStream  
    {
        private OrderedDictionary Streams;

        #region Properties

        public T this[int index]
        {
            get { return Streams[index] as T; }
        }
        public T this[string key]
        {
            get { return Streams[key] as T; }
        }

        public int Count
        {
            get { return Streams.Count; }
        }

        #endregion

        #region Constructors/Destructors
        internal VlmStreamCollection()
        {
            Streams = new OrderedDictionary();

        }
        #endregion

        #region Methods

        public bool Contains(string key)
        {
            return Streams.Contains(key);
        }

        //Internal methods.  This is what makes it a read-only list
        internal void Add(string key, T value)
        {
            Streams.Add(key, value);
        }

        internal void Clear()
        {
            Streams.Clear();
        }

        internal void Remove(string key)
        {
            Streams.Remove(key);
        }
        #endregion


        #region IEnumerable Members

        IEnumerator IEnumerable.GetEnumerator()
        {
            return Streams.GetEnumerator();
        }

        #endregion
    }
}
